<script lang="ts" setup>
import { getCurrentInstance, onMounted, ref,useTemplateRef } from "vue";
// 获取url参数
import { useRoute } from 'vue-router';
// 获取当前组件实例
const instance = getCurrentInstance();

// 确保instance存在并且有proxy属性
const route = useRoute();
const name = route.query.name;
console.log(name);
const str = ref(`<img src="https://img1.baidu.com/it/u=2931243091,718249849&fm=253&fmt=auto&app=120&f=JPEG?w=569&h=427*' onload="alert('hacked' )" style=" width:95px; height:95px"/>`);
console.log(encodeURIComponent(str.value));
const msg = encodeURIComponent(str.value);

const input=useTemplateRef('input');
onMounted(() => {
    input.value?.focus();
})
</script>

<template>
    <div>{{ msg }}</div>
    <div v-html="name"></div>
    <dvi>{{}}</dvi>
    <input ref="input">
</template>

<style lang="less" scoped></style>